
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.9 Jobs、CronJobs · Kubernetes - 痴者工良</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="痴者工良">
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../4.network/" />
    
    
    <link rel="prev" href="8.schedule.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://www.whuanle.cn" target="_blank" class="custom-link">痴者工良的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    文档说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    1.基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../1.basic/1.docker.html">
            
                <a href="../1.basic/1.docker.html">
            
                    
                    1.1 说透 Docker：基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../1.basic/2.virtual.html">
            
                <a href="../1.basic/2.virtual.html">
            
                    
                    1.2 说透 Docker： 虚拟化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../1.basic/3.docker_network.html">
            
                <a href="../1.basic/3.docker_network.html">
            
                    
                    1.3 了解 Docker 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../1.basic/4.pod_docker.html">
            
                <a href="../1.basic/4.pod_docker.html">
            
                    
                    1.4 Docker 和 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../1.basic/5.k8s.html">
            
                <a href="../1.basic/5.k8s.html">
            
                    
                    1.5 K8S入门基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../2.deploy/">
            
                <a href="../2.deploy/">
            
                    
                    2.部署和配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../2.deploy/2.deploy.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../2.deploy/1.minikube.html">
            
                <a href="../2.deploy/1.minikube.html">
            
                    
                    2.1 使用 Minikube 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../2.deploy/2.kubeadm.html">
            
                <a href="../2.deploy/2.kubeadm.html">
            
                    
                    2.2 使用 kubeadm 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../2.deploy/3.kubeadm_ckad.html">
            
                <a href="../2.deploy/3.kubeadm_ckad.html">
            
                    
                    2.3 CKAD认证中的部署教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../2.deploy/4.kubeadm_proxy.html">
            
                <a href="../2.deploy/4.kubeadm_proxy.html">
            
                    
                    2.4 国内代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../2.deploy/5.dashboard.html">
            
                <a href="../2.deploy/5.dashboard.html">
            
                    
                    2.5 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="./">
            
                <a href="./">
            
                    
                    3.Pod部署和调度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="./">
            
                <a href="./">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="1.pod.html">
            
                <a href="1.pod.html">
            
                    
                    3.1 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="2.deployment.html">
            
                <a href="2.deployment.html">
            
                    
                    3.2 Deployment部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="3.replica.html">
            
                <a href="3.replica.html">
            
                    
                    3.3 副本集(ReplicaSet)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="4.pod_network.html">
            
                <a href="4.pod_network.html">
            
                    
                    3.34 Pod 端口映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="5.update.html">
            
                <a href="5.update.html">
            
                    
                    3.5 Pod 升级、回滚
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="6.scale.html">
            
                <a href="6.scale.html">
            
                    
                    3.6 Pod 缩放
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="7.lable.html">
            
                <a href="7.lable.html">
            
                    
                    3.7.Pod 标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="8.schedule.html">
            
                <a href="8.schedule.html">
            
                    
                    3.8 Pod 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.10" data-path="9.jobs_cronjobs.html">
            
                <a href="9.jobs_cronjobs.html">
            
                    
                    3.9 Jobs、CronJobs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../4.network/">
            
                <a href="../4.network/">
            
                    
                    4.Kubernetes 网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../4.network/">
            
                <a href="../4.network/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../4.network/1.network.html">
            
                <a href="../4.network/1.network.html">
            
                    
                    4.1 Kubernetes 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../4.network/2.endpoint.html">
            
                <a href="../4.network/2.endpoint.html">
            
                    
                    4.2 Endpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../4.network/3.ingress.html">
            
                <a href="../4.network/3.ingress.html">
            
                    
                    4.3 ingress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../4.network/4.discovery.html">
            
                <a href="../4.network/4.discovery.html">
            
                    
                    4.4 服务发现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    5.volumes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../5.volumes/1.volumes.html">
            
                <a href="../5.volumes/1.volumes.html">
            
                    
                    5.1 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../5.volumes/2.secret_configmap.html">
            
                <a href="../5.volumes/2.secret_configmap.html">
            
                    
                    5.2 secret 和 ConfigMap 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../5.volumes/3.nfts.html">
            
                <a href="../5.volumes/3.nfts.html">
            
                    
                    5.3 NFS卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../5.volumes/4.pv_pvc.html">
            
                <a href="../5.volumes/4.pv_pvc.html">
            
                    
                    5.4 持久化卷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    6.API 和 安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../7.health/">
            
                <a href="../7.health/">
            
                    
                    7.维护和故障排除
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../8.health/README.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../k8s.html">
            
                <a href="../k8s.html">
            
                    
                    Kubernetes 命令概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../ckad.html">
            
                <a href="../ckad.html">
            
                    
                    CKAD 认证帮助
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >3.9 Jobs、CronJobs</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#39-jobs&#x3001;cronjobs"><b></b>3.9 Jobs&#x3001;CronJobs</a></li><ul><li><span class="title-icon "></span><a href="#job"><b></b>Job</a></li><ul><li><span class="title-icon "></span><a href="#&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;"><b></b>&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;</a></li><li><span class="title-icon "></span><a href="#job_1"><b></b>Job</a></li><li><span class="title-icon "></span><a href="#&#x5B8C;&#x6210;&#x6570;"><b></b>&#x5B8C;&#x6210;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x5E76;&#x884C;"><b></b>&#x5E76;&#x884C;</a></li><li><span class="title-icon "></span><a href="#&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684;-job"><b></b>&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684; Job</a></li><li><span class="title-icon "></span><a href="#&#x5E26;&#x7C7B;&#x578B;&#x7684;-job"><b></b>&#x5E26;&#x7C7B;&#x578B;&#x7684; Job</a></li></ul><li><span class="title-icon "></span><a href="#&#x5904;&#x7406;-pod-&#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;"><b></b>&#x5904;&#x7406; Pod &#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;</a></li><ul><li><span class="title-icon "></span><a href="#job-&#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;"><b></b>Job &#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;</a></li></ul><li><span class="title-icon "></span><a href="#cronjob"><b></b>CronJob</a></li></ul></ul></div><h1 id="39-jobs&#x3001;cronjobs"><a name="39-jobs&#x3001;cronjobs" class="anchor-navigation-ex-anchor" href="#39-jobs&#x3001;cronjobs"><i class="fa fa-link" aria-hidden="true"></i></a>3.9 Jobs&#x3001;CronJobs</h1>
<p>&#x5728; Kubernetes &#x4E2D;&#xFF0C;&#x5E38;&#x7528;&#x7684;&#x5DE5;&#x4F5C;&#x8D1F;&#x8F7D;/&#x63A7;&#x5236;&#x5668;&#xFF0C;&#x6709; Deployment&#x3001;ReplicaSet&#x3001;StatefulSet&#x3001;DaemonSet&#x3001;Job&#x3001;Cronjob&#x3001;ReplicationController &#x7B49;&#xFF0C;&#x5728;&#x524D;&#x9762;&#xFF0C;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5B66;&#x4E60;&#x4E86; Deloyment&#x3001;DaemonSet&#x3001;ReplicationController&#xFF0C;&#x672C;&#x7AE0;&#x5C06;&#x5B66;&#x4E60; Job &#x548C; Cronjob&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x77E5;&#x9053;&#xFF0C;Pod &#x662F;&#x4E00;&#x79CD;&#x4E34;&#x65F6;&#x6027;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x6211;&#x4EEC;&#x5355;&#x72EC;&#x521B;&#x5EFA; Pod&#xFF0C;&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x4E34;&#x65F6;&#x6D4B;&#x8BD5;&#x8C03;&#x8BD5;&#xFF0C;&#x5728;&#x751F;&#x4EA7;&#x4E2D;&#x6211;&#x4EEC;&#x4F7F;&#x7528; Deployment &#x7B49;&#x5BF9; Pod &#x8FDB;&#x884C;&#x7BA1;&#x7406;&#x3002;&#x800C; Job&#x3001;Cronjob &#x5B83;&#x4EEC;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A; Pod&#xFF0C;&#x6765;&#x5B8C;&#x6210;&#x67D0;&#x4E9B;&#x4EFB;&#x52A1;&#xFF0C;&#x5B83;&#x4EEC;&#x521B;&#x5EFA;&#x7684; Pod &#x4E0D;&#x4F1A;&#x957F;&#x4E45;&#x7684;&#x8FD0;&#x884C;&#x5728;&#x8282;&#x70B9;&#x4E2D;&#x3002;</p>
<h2 id="job"><a name="job" class="anchor-navigation-ex-anchor" href="#job"><i class="fa fa-link" aria-hidden="true"></i></a>Job</h2>
<p>Job &#x662F;&#x7528;&#x6765;&#x53EA;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#x4EFB;&#x52A1;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;Job &#x5BF9;&#x8C61;&#x4EE5;&#x4E00;&#x79CD;&#x53EF;&#x9760;&#x7684;&#x65B9;&#x5F0F;&#x8FD0;&#x884C;&#x67D0; Pod &#x76F4;&#x5230;&#x5B8C;&#x6210;&#xFF0C;&#x9002;&#x5408;&#x7528;&#x4E8E;&#x6279;&#x5904;&#x7406;&#xFF0C;&#x4F8B;&#x5982;&#x7F16;&#x8BD1;&#x7A0B;&#x5E8F;&#x3001;&#x6267;&#x884C;&#x8FD0;&#x7B97;&#x4EFB;&#x52A1;&#x3002;Job &#x9002;&#x5408;&#x4E00;&#x6B21;&#x5230;&#x4F4D;&#x6216;&#x8005;&#x4E00;&#x6B21;&#x5B8C;&#x6574;&#x7684;&#x6D41;&#x7A0B;&#xFF0C;&#x5B8C;&#x6210;&#x540E;&#x5373;&#x53EF;&#x629B;&#x5F03;&#x7684;&#x4EFB;&#x52A1;&#x3002;</p>
<h3 id="&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;"><a name="&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;" class="anchor-navigation-ex-anchor" href="#&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x63A7;&#x5236;&#x5668;&#x5F02;&#x540C;&#x70B9;</h3>
<p>&#x524D;&#x9762;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5B66;&#x4E60;&#x5230;&#x4E86; Deployment &#x3001;ReplicaSet&#xFF0C;Job &#x8DDF;&#x5B83;&#x4EEC;&#x4E00;&#x4E9B;&#x5F02;&#x540C;&#x70B9;&#xFF0C;&#x8FD9;&#x91CC;&#x5217;&#x4E3E;&#x4E00;&#x4E9B;&#x5B83;&#x4EEC;&#x5404;&#x81EA;&#x7684;&#x7279;&#x70B9;&#x3002;</p>
<ul>
<li><p>Pod &#x751F;&#x547D;&#x671F;</p>
<p>&#x548C;&#x4E00;&#x4E2A;&#x4E2A;&#x72EC;&#x7ACB;&#x7684;&#x5E94;&#x7528;&#x5BB9;&#x5668;&#x4E00;&#x6837;&#xFF0C;Pod &#x4E5F;&#x88AB;&#x8BA4;&#x4E3A;&#x662F;&#x76F8;&#x5BF9;&#x4E34;&#x65F6;&#x6027;&#xFF08;&#x800C;&#x4E0D;&#x662F;&#x957F;&#x671F;&#x5B58;&#x5728;&#xFF09;&#x7684;&#x5B9E;&#x4F53;&#x3002; Pod &#x4F1A;&#x88AB;&#x521B;&#x5EFA;&#x3001;&#x8D4B;&#x4E88;&#x4E00;&#x4E2A;&#x552F;&#x4E00;&#x7684; ID&#xFF0C; &#x5E76;&#x88AB;&#x8C03;&#x5EA6;&#x5230;&#x8282;&#x70B9;&#xFF0C;&#x5E76;&#x5728;&#x7EC8;&#x6B62;&#xFF08;&#x6839;&#x636E;&#x91CD;&#x542F;&#x7B56;&#x7565;&#xFF09;&#x6216;&#x5220;&#x9664;&#x4E4B;&#x524D;&#x4E00;&#x76F4;&#x8FD0;&#x884C;&#x5728;&#x8BE5;&#x8282;&#x70B9;&#x3002;</p>
</li>
<li><p>Pod &#x662F;&#x4E34;&#x65F6;&#x7684;</p>
<p>Pod &#x81EA;&#x8EAB;&#x4E0D;&#x5177;&#x6709;&#x81EA;&#x6108;&#x80FD;&#x529B;&#x3002;&#x5982;&#x679C; Pod &#x88AB;&#x8C03;&#x5EA6;&#x5230;&#x67D0;&#x8282;&#x70B9; &#x800C;&#x8BE5;&#x8282;&#x70B9;&#x4E4B;&#x540E;&#x5931;&#x6548;&#xFF0C;&#x6216;&#x8005;&#x8C03;&#x5EA6;&#x64CD;&#x4F5C;&#x672C;&#x8EAB;&#x5931;&#x6548;&#xFF0C;Pod &#x4F1A;&#x88AB;&#x5220;&#x9664;&#xFF1B;&#x4E0E;&#x6B64;&#x7C7B;&#x4F3C;&#xFF0C;Pod &#x65E0;&#x6CD5;&#x5728;&#x8282;&#x70B9;&#x8D44;&#x6E90;&#x8017;&#x5C3D;&#x6216;&#x8005;&#x8282;&#x70B9;&#x7EF4;&#x62A4;&#x671F;&#x95F4;&#x7EE7;&#x7EED;&#x5B58;&#x6D3B;&#x3002;Deployment&#x3001;ReplicaSet&#x3001;Job &#x90FD;&#x4F1A;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x65B0;&#x7684; Pod &#x6765;&#x66FF;&#x4EE3;&#x5DF2;&#x7EC8;&#x6B62;&#x7684; Pod&#x3002;</p>
</li>
<li><p>Deployment/ReplicaSet&#x3001;Job</p>
<p>Deployment/ReplicaSet &#x63A7;&#x5236;&#x5668;&#x7BA1;&#x7406;&#x7684;&#x662F;&#x90A3;&#x4E9B;&#x4E0D;&#x5E0C;&#x671B;&#x88AB;&#x7EC8;&#x6B62;&#x7684; Pod (&#x4F8B;&#x5982;&#xFF0C;Web &#x670D;&#x52A1;&#x5668;)&#xFF0C; Job &#x7BA1;&#x7406;&#x7684;&#x662F;&#x90A3;&#x4E9B;&#x5E0C;&#x671B;&#x88AB;&#x9884;&#x671F;&#x7EC8;&#x6B62;&#x7684; Pod( &#x4F8B;&#x5982;&#xFF0C;&#x6279;&#x5904;&#x7406;&#x4F5C;&#x4E1A;)&#x3002;</p>
</li>
<li><p>&#x4E3A;&#x4EC0;&#x4E48;&#x4E0D;&#x7528; Pod</p>
<p>Pod &#x662F;&#x4E34;&#x65F6;&#x6027;&#x7684;&#xFF0C;&#x6709; Always&#x3001;OnFailure&#x3001;Never &#x7B49;&#x9009;&#x9879;&#xFF0C;&#x8BBE;&#x7F6E;&#x5728;&#x5BB9;&#x5668;&#x65E0;&#x6CD5;&#x542F;&#x52A8;&#x65F6;&#x7684;&#x91CD;&#x8BD5;&#x673A;&#x5236;&#xFF1B;&#x800C; Job &#x53EA;&#x6709; OnFailure &#x3001;Never &#xFF0C;Job &#x6700;&#x591A;&#x53EA;&#x80FD;&#x91CD;&#x8BD5;&#x4E00;&#x6B21;&#x3002;Pod &#x5728;&#x81EA;&#x8EAB;&#x6CA1;&#x6709;&#x4FDD;&#x969C;&#xFF0C;&#x6302;&#x4E86;&#x5C31;&#x6302;&#x4E86;&#xFF0C;&#x800C;&#x4E14; Pod &#x672C;&#x8EAB;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x3002;Job &#x4F1A;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A; Pods&#xFF0C;&#x5728;&#x5931;&#x8D25;&#x65F6;&#x5C06;&#x7EE7;&#x7EED;&#x91CD;&#x8BD5; Pods &#x7684;&#x6267;&#x884C;&#xFF0C;&#x6216;&#x8005;&#x521B;&#x5EFA;&#x65B0;&#x7684; Pod&#xFF0C;&#x76F4;&#x5230;&#x6307;&#x5B9A;&#x6570;&#x91CF;&#x7684; Pods &#x6210;&#x529F;&#x7EC8;&#x6B62;&#x3002;</p>
</li>
</ul>
<h3 id="job_1"><a name="job_1" class="anchor-navigation-ex-anchor" href="#job_1"><i class="fa fa-link" aria-hidden="true"></i></a>Job</h3>
<p>&#x5F53; Job &#x542F;&#x52A8;&#x65F6;&#xFF0C;Job &#x4F1A;&#x8DDF;&#x8E2A;&#x6210;&#x529F;&#x5B8C;&#x6210;&#x7684; Pod &#x7684;&#x4E2A;&#x6570;&#xFF0C;&#x5F53;&#x6210;&#x529F;&#x6570;&#x91CF;&#x8FBE;&#x5230;&#x67D0;&#x4E2A;&#x9608;&#x503C;&#x65F6;&#xFF0C;Job &#x4F1A;&#x88AB;&#x7EC8;&#x7ED3;&#x3002;&#x5F53; Job &#x8FD0;&#x884C;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC; &#x6682;&#x505C;/&#x6302;&#x8D77; Job&#xFF0C;Job &#x4F1A;&#x5220;&#x9664;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x7684; Pod&#xFF0C;&#x4FDD;&#x7559;&#x5DF2;&#x5B8C;&#x6210;&#x7684; Pod &#x6570;&#x91CF;&#xFF0C;&#x5F53;&#x6062;&#x590D; Job &#x65F6;&#xFF0C;&#x4F1A;&#x521B;&#x5EFA;&#x65B0;&#x7684; Pod&#xFF0C;&#x7EE7;&#x7EED;&#x5B8C;&#x6210;&#x4EFB;&#x52A1;&#x3002;</p>
<p>Job &#x7684;&#x7ED3;&#x6784;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E2A;&#x793A;&#x4F8B;&#xFF0C;&#x8FD9;&#x4E2A; Job &#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x955C;&#x50CF;&#xFF0C;&#x542F;&#x52A8;&#x540E;&#x6267;&#x884C; <code>sleep 3</code> &#x547D;&#x4EE4;&#xFF0C;&#x5BB9;&#x5668;&#x4F1A;&#x5728;3&#x79D2;&#x540E;&#x81EA;&#x52A8;&#x9000;&#x51FA;&#xFF0C;Job &#x6807;&#x8BB0;&#x5176;&#x5DF2;&#x7ECF;&#x5B8C;&#x6210;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span> 
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">image</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;/bin/sleep&quot;</span><span class="token punctuation">]</span>
        <span class="token key atrule">args</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;3&quot;</span><span class="token punctuation">]</span>
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Never
</code></pre>
<blockquote>
<p>&#x5BF9;&#x4E8E;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684; Job&#xFF0C;&#x5176;&#x5173;&#x952E;&#x5728;&#x4E8E;&#x8BBE;&#x5B9A;&#x4E00;&#x4E2A;&#x53EF;&#x7ED3;&#x675F;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x5BB9;&#x5668;&#x6267;&#x884C;&#x547D;&#x4EE4;&#x540E;&#x4F1A;&#x9000;&#x51FA;&#x3002;</p>
<p>&#x6B64;&#x65F6;&#x8FD9;&#x4E2A;&#x5BB9;&#x5668;&#x88AB;&#x6807;&#x8BB0;&#x4E3A;&#x5B8C;&#x6210;&#x72B6;&#x6001;&#x3002;</p>
<pre class="language-"><code>       command: [&quot;/bin/sleep&quot;]
       args: [&quot;3&quot;]
     restartPolicy: Never
</code></pre><p><code>restartPolicy</code> &#x9700;&#x8981;&#x6807;&#x8BB0;&#x4E3A; Never &#x6216; OnFailure&#x3002;</p>
</blockquote>
<p>&#x4F7F;&#x7528; <code>kubectl apply -f job.yaml</code> &#x547D;&#x4EE4;&#x542F;&#x52A8;&#x6B64; Job&#xFF0C;3 &#x79D2;&#x540E;&#x67E5;&#x770B; Pod&#xFF1A;</p>
<pre class="language-"><code>root@instance-1:~# kubectl get pods
NAME                          READY   STATUS      RESTARTS   AGE
busybox-k4wkn                 0/1     Completed   0          16s
</code></pre><p>&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x6B64; Pod &#x5904;&#x4E8E;&#x5B8C;&#x6210;&#x72B6;&#x6001;(Completed)&#xFF0C;&#x518D;&#x67E5;&#x770B; job &#x5217;&#x8868;&#xFF1A;</p>
<pre class="language-"><code>root@instance-1:~# kubectl get jobs
NAME      COMPLETIONS   DURATION   AGE
busybox   1/1           11s        101s
</code></pre><p>&#x5B8C;&#x6210;&#x540E;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x5220;&#x9664;&#x5B83;&#xFF1A;</p>
<pre class="language-"><code>kubectl delete job busybox
</code></pre><p>&#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x7B80;&#x5355;&#x7684; Job&#xFF0C;&#x79F0;&#x4E3A;&#x975E;&#x5E76;&#x884C;&#x7684;&#xFF0C;&#x5B83;&#x7684;&#x7279;&#x70B9;&#x6709;&#xFF1A;</p>
<ul>
<li>&#x53EA;&#x542F;&#x52A8;&#x4E00;&#x4E2A; Pod&#xFF0C;&#x9664;&#x975E;&#x8BE5; Pod &#x5931;&#x8D25;&#xFF1B;</li>
<li>&#x5F53; Pod &#x6210;&#x529F;&#x7EC8;&#x6B62;&#x65F6;&#xFF0C;&#x7ACB;&#x5373;&#x89C6; Job &#x4E3A;&#x5B8C;&#x6210;&#x72B6;&#x6001;&#xFF1B;</li>
</ul>
<p>&#x8FD9;&#x91CC;&#x518D;&#x5217;&#x4E3E;&#x4E00;&#x4E2A; Job &#x793A;&#x4F8B;&#xFF0C;&#x8FD9;&#x4E2A; Job &#x7528;&#x4E8E;&#x8BA1;&#x7B97;&#x5706;&#x5468;&#x7387;&#xFF0C;&#x8BA1;&#x7B97;&#x5B8C;&#x6BD5;&#x540E;&#x6253;&#x5370;&#x5706;&#x5468;&#x7387;&#x5E76;&#x7ED3;&#x675F;&#x5BB9;&#x5668;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> pi
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> pi
        <span class="token key atrule">image</span><span class="token punctuation">:</span> perl
        <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;perl&quot;</span><span class="token punctuation">,</span>  <span class="token string">&quot;-Mbignum=bpi&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;-wle&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;print bpi(2000)&quot;</span><span class="token punctuation">]</span>
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Never
  <span class="token key atrule">backoffLimit</span><span class="token punctuation">:</span> <span class="token number">4</span>
</code></pre>
<p>&#x67E5;&#x770B; Pod &#x5217;&#x8868;&#xFF0C;&#x627E;&#x5230; <code>pi-</code> &#x5F00;&#x5934;&#x7684; Pod&#xFF0C;&#x67E5;&#x770B;&#x65E5;&#x5FD7;&#xFF1A;</p>
<pre class="language-"><code>root@instance-1:~# kubectl logs pi-7htxl
3.1415926535897932384626433... ...
</code></pre><blockquote>
<p><code>.spec.backoffLimit</code> &#x53EF;&#x89C6;&#x4E3A; Job &#x5728;&#x5931;&#x8D25;&#x4E4B;&#x524D;&#x7684;&#x91CD;&#x8BD5;&#x6B21;&#x6570;&#x3002;</p>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x8BBE;&#x7F6E;&#x4E86; <code>restartPolicy: OnFailure</code>&#xFF0C;&#x90A3;&#x4E48;&#x6B64; Pod &#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#x4E00;&#x6B21;&#xFF1B;</p>
<p>&#x5982;&#x679C; <code>restartPolicy: Never</code>&#xFF0C;&#x5E76;&#x4E14;&#x8BBE;&#x7F6E;&#x4E86; <code>backoffLimit</code>&#xFF0C;Pod &#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#x591A;&#x6B21;&#x3002;</p>
</blockquote>
<h3 id="&#x5B8C;&#x6210;&#x6570;"><a name="&#x5B8C;&#x6210;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x5B8C;&#x6210;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B8C;&#x6210;&#x6570;</h3>
<p>&#x4F7F;&#x7528;<code>.spec.completions</code> &#x6765;&#x8BBE;&#x7F6E;&#x5B8C;&#x6210;&#x6570;&#x65F6;&#xFF0C;Job &#x63A7;&#x5236;&#x5668;&#x6240;&#x521B;&#x5EFA;&#x7684;&#x6BCF;&#x4E2A; Pod &#x4F7F;&#x7528;&#x5B8C;&#x5168;&#x76F8;&#x540C;&#x7684; <code>spec</code> &#x6A21;&#x677F;&#x3002; &#x8FD9;&#x610F;&#x5473;&#x7740;&#x4EFB;&#x52A1;&#x7684;&#x6240;&#x6709; Pod &#x90FD;&#x6709;&#x76F8;&#x540C;&#x7684;&#x547D;&#x4EE4;&#x884C;&#xFF0C;&#x90FD;&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x7684;&#x955C;&#x50CF;&#x548C;&#x6570;&#x636E;&#x5377;&#xFF0C;&#x751A;&#x81F3;&#x8FDE; &#x73AF;&#x5883;&#x53D8;&#x91CF;&#x90FD;&#xFF08;&#x51E0;&#x4E4E;&#xFF09;&#x76F8;&#x540C;&#x3002;</p>
<p>&#x5982;&#x4E0B; YAML&#xFF0C;<code>template</code> &#x4E2D;&#x7684; <code>spec</code>&#xFF0C;&#x662F;&#x6BCF;&#x4E2A; Pod &#x90FD;&#x5E26;&#x6709;&#x7684;&#x76F8;&#x5173;&#x5C5E;&#x6027;&#xFF0C;&#x4F7F;&#x5F97;&#x6BCF;&#x4E2A; Pod &#x90FD;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">completions</span><span class="token punctuation">:</span> <span class="token number">5</span> 
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
</code></pre>
<p>Job &#x4F1A;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A; Pods&#xFF0C;&#x5E76;&#x5C06;&#x7EE7;&#x7EED;&#x91CD;&#x8BD5; Pods &#x7684;&#x6267;&#x884C;&#xFF0C;&#x76F4;&#x5230;&#x6307;&#x5B9A;&#x6570;&#x91CF;&#x7684; Pods &#x6210;&#x529F;&#x7EC8;&#x6B62;&#x3002; &#x968F;&#x7740; Pods &#x6210;&#x529F;&#x7ED3;&#x675F;&#xFF0C;Job &#x8DDF;&#x8E2A;&#x8BB0;&#x5F55;&#x6210;&#x529F;&#x5B8C;&#x6210;&#x7684; Pods &#x4E2A;&#x6570;&#x3002; &#x5F53;&#x6570;&#x91CF;&#x8FBE;&#x5230;&#x6307;&#x5B9A;&#x7684;&#x6210;&#x529F;&#x4E2A;&#x6570;&#x9608;&#x503C;&#x65F6;&#xFF0C;&#x4EFB;&#x52A1;&#xFF08;&#x5373; Job&#xFF09;&#x7ED3;&#x675F;&#x3002; &#x5220;&#x9664; Job &#x7684;&#x64CD;&#x4F5C;&#x4F1A;&#x6E05;&#x9664;&#x6240;&#x521B;&#x5EFA;&#x7684;&#x5168;&#x90E8; Pods&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x7EE7;&#x7EED;&#x4F7F;&#x7528;&#x4E0A;&#x6B21;&#x7684; Job &#x6A21;&#x677F;&#xFF0C;&#x8FD9;&#x91CC;&#x589E;&#x52A0;&#x4E00;&#x4E2A; <code>completions</code> &#xFF0C;&#x5B8C;&#x6574; YAML &#x5185;&#x5BB9;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">completions</span><span class="token punctuation">:</span> <span class="token number">5</span> 
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span> 
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">image</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;/bin/sleep&quot;</span><span class="token punctuation">]</span>
        <span class="token key atrule">args</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;3&quot;</span><span class="token punctuation">]</span>
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Never
</code></pre>
<p>&#x4F7F;&#x7528; <code>kubectl apply -f job.yaml</code> &#x542F;&#x52A8;&#x6B64; Job&#x3002;</p>
<p>&#x67E5;&#x770B; Job &#x548C; Pod&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@instance-1:~<span class="token comment"># kubectl get jobs</span>
NAME      COMPLETIONS   DURATION   AGE
busybox   <span class="token number">5</span>/5           36s        38s
root@instance-2:~<span class="token comment"># kubectl get pods</span>
NAME                          READY   STATUS      RESTARTS   AGE
busybox-rfhcj                 <span class="token number">0</span>/1     Completed   <span class="token number">0</span>          9s
busybox-stkbg                 <span class="token number">0</span>/1     Completed   <span class="token number">0</span>          23s
busybox-xk6sb                 <span class="token number">0</span>/1     Completed   <span class="token number">0</span>          30s
busybox-z6h9x                 <span class="token number">0</span>/1     Completed   <span class="token number">0</span>          40s
busybox-zqgcb                 <span class="token number">0</span>/1     Completed   <span class="token number">0</span>          16s
</code></pre>
<blockquote>
<p>Pod &#x7684;&#x521B;&#x5EFA;&#x662F;&#x4E32;&#x884C;&#x7684;&#xFF0C;&#x6BCF;&#x6B21;&#x53EA;&#x8FD0;&#x884C;&#x4E00;&#x4E2A; Pod&#xFF0C;&#x5F53;&#x4E00;&#x4E2A; Pod &#x5904;&#x4E8E; Completed &#x72B6;&#x6001;&#x65F6;&#xFF0C;&#x521B;&#x5EFA;&#x4E0B;&#x4E00;&#x4E2A; Pod&#x3002;&#x5F53;&#x6709; 5 &#x4E2A; Pod &#x5904;&#x4E8E; Completed &#x72B6;&#x6001;&#x65F6;&#xFF0C;&#x6B64; Job &#x6807;&#x8BB0;&#x5B8C;&#x6210;&#x3002;</p>
</blockquote>
<p>&#x524D;&#x9762;&#x5B66;&#x4E60;&#x5230;&#x4E86; <code>completions</code>&#xFF0C;&#x4E32;&#x884C;&#x542F;&#x52A8; Pod&#xFF0C;&#x76F4;&#x5230; Pod &#x5B8C;&#x6210;&#x6570;&#x91CF;&#x4E3A; 5 &#x3002;</p>
<p>&#x5982;&#x679C;&#x7ECF;&#x5E38;&#x67E5;&#x770B; Job &#x7684;&#x72B6;&#x6001;&#xFF0C;&#x53EF;&#x4EE5;&#x89C2;&#x5BDF;&#x5230;&#xFF1A;</p>
<pre class="language-"><code>NAME      COMPLETIONS   DURATION   AGE
busybox   1/5           30s        10s

NAME      COMPLETIONS   DURATION   AGE
busybox   2/5           28s        18s

NAME      COMPLETIONS   DURATION   AGE
busybox   3/5           28s        25s

root@instance-1:~# kubectl get jobs
NAME      COMPLETIONS   DURATION   AGE
busybox   4/5           30s        30s

root@instance-1:~# kubectl get jobs
NAME      COMPLETIONS   DURATION   AGE
busybox   5/5           36s        37s
</code></pre><div class="mermaid">
flowchart LR
    Start --&gt; busybox1 --&gt; busybox2 --&gt; busybox3 --&gt; busybox4 --&gt; busybox5 --&gt; Stop
</div>





<h3 id="&#x5E76;&#x884C;"><a name="&#x5E76;&#x884C;" class="anchor-navigation-ex-anchor" href="#&#x5E76;&#x884C;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E76;&#x884C;</h3>
<p>&#x6211;&#x4EEC;&#x67E5;&#x770B;&#x524D;&#x9762;&#x8BBE;&#x7F6E; Job &#x7684; YAML &#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl get job busybox -o yaml
</code></pre>
<pre class="language-"><code class="lang-yaml"><span class="token punctuation">...</span> <span class="token punctuation">...</span>
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">backoffLimit</span><span class="token punctuation">:</span> <span class="token number">6</span>
  <span class="token key atrule">completions</span><span class="token punctuation">:</span> <span class="token number">5</span>
  <span class="token key atrule">parallelism</span><span class="token punctuation">:</span> <span class="token number">1</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
  <span class="token punctuation">...</span> <span class="token punctuation">...</span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230; <code>parallelism=1</code>&#xFF0C;&#x8FD9;&#x4E2A; <code>parallelism</code> &#x6B63;&#x662F;&#x63A7;&#x5236;&#x5E76;&#x884C;&#x5EA6;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x7531;&#x4E8E;&#x8FD9;&#x4E2A;&#x5B57;&#x6BB5;&#x9ED8;&#x8BA4;&#x4E3A; 1&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x4E2A; Job &#x6BCF;&#x6B21;&#x53EA;&#x80FD;&#x8FD0;&#x884C;&#x4E00;&#x4E2A; Pod&#x3002;</p>
<blockquote>
<p><code>spec.completions</code> &#x548C; <code>spec.parallelism</code>&#xFF0C;&#x8FD9;&#x4E24;&#x4E2A;&#x5C5E;&#x6027;&#x90FD;&#x4E0D;&#x8BBE;&#x7F6E;&#x65F6;&#xFF0C;&#x5747;&#x53D6;&#x9ED8;&#x8BA4;&#x503C; 1&#x3002;</p>
</blockquote>
<p>&#x5F53;&#x6211;&#x4EEC;&#x4FEE;&#x6539;&#x8FD9;&#x4E2A; <code>parallelism</code> &#x503C;&#x5927;&#x4E8E; 1 &#x65F6;&#xFF0C;&#x591A;&#x4E2A; Pod &#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x6267;&#x884C;&#x3002;</p>
<p><code>.spec.parallelism</code>&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x4E3A;&#x4EFB;&#x4F55;&#x975E;&#x8D1F;&#x6574;&#x6570;&#x3002; &#x5982;&#x679C;&#x8BBE;&#x7F6E;&#x4E3A; 0&#xFF0C;&#x5219; Job &#x76F8;&#x5F53;&#x4E8E;&#x542F;&#x52A8;&#x4E4B;&#x540E;&#x4FBF;&#x88AB;&#x6682;&#x505C;&#xFF0C;&#x56E0;&#x4E3A;&#x4E00;&#x76F4;&#x6CA1;&#x6709; Pod &#x5B8C;&#x6210;&#xFF0C;&#x5F53;&#x7136;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>kubectl edit</code> &#x547D;&#x4EE4;&#x4FEE;&#x6539;&#x5176;&#x503C;&#x3002;</p>
<p>&#x53E6;&#x5916;&#xFF0C;&#x53EF;&#x4EE5; Job &#x8FD0;&#x884C;&#x65F6;&#xFF0C;&#x4F7F;&#x7528; <code>kubecl scale job xxxx --replicas=n</code>  &#x4FEE;&#x6539; Job &#x7684;&#x5E76;&#x884C;&#x6570;&#x91CF; <code>parallelism</code> &#x5B57;&#x6BB5;&#x7684;&#x503C;&#x3002;</p>
<p>&#x5F53; <code>parallelism=2</code> &#x65F6;&#xFF0C;&#x5176;&#x542F;&#x52A8;&#x8FC7;&#x7A0B;&#x53EF;&#x80FD;&#x5982;&#x4E0B;&#xFF1A;</p>
<div class="mermaid">
graph TD;
    Start--&gt;busybox1
    Start--&gt;busybox2;
    busybox1--&gt;busybox3;
    busybox2--&gt;busybox4;
    busybox3--&gt;busybox5;
</div>





<h3 id="&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684;-job"><a name="&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684;-job" class="anchor-navigation-ex-anchor" href="#&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684;-job"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684; Job</h3>
<p>&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684; Job&#xFF0C;&#x6307;&#x8BBE;&#x7F6E;&#x4E86; <code>.spec.parallelism</code>&#xFF0C;&#x53EF;&#x4EE5;&#x4E0D;&#x8BBE;&#x7F6E; <code>.spec.completions</code> &#x7684; Job&#x3002;</p>
<p>&#x6B64;&#x65F6; Job &#x9700;&#x8981;&#x7B49;&#x5F85;&#x6240;&#x6709;&#x7684; Pod &#x5B8C;&#x6210;&#x4EFB;&#x52A1;&#xFF0C;Job &#x624D;&#x80FD;&#x7EC8;&#x7ED3;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; Job&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x542F;&#x52A8; 5 &#x4E2A; Pod&#xFF0C;&#x6BCF;&#x4E2A; Pod &#x4E0D;&#x65AD;&#x5411; RabbitMQ &#x8BF7;&#x6C42;&#x6D88;&#x8D39;&#x4E00;&#x6761;&#x6D88;&#x606F;&#xFF0C;&#x5F53; RabbitMQ &#x5DF2;&#x7ECF;&#x6CA1;&#x6709;&#x53EF;&#x6D88;&#x8D39;&#x7684;&#x6D88;&#x606F;&#x65F6;&#xFF0C;Pod &#x7ED3;&#x675F;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> job<span class="token punctuation">-</span>wq<span class="token punctuation">-</span><span class="token number">1</span>
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">parallelism</span><span class="token punctuation">:</span> <span class="token number">5</span>
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">metadata</span><span class="token punctuation">:</span>
      <span class="token key atrule">name</span><span class="token punctuation">:</span> job<span class="token punctuation">-</span>wq<span class="token punctuation">-</span><span class="token number">1</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> c
        <span class="token key atrule">image</span><span class="token punctuation">:</span> gcr.io/&lt;project<span class="token punctuation">&gt;</span>/job<span class="token punctuation">-</span>wq<span class="token punctuation">-</span><span class="token number">1</span>
        <span class="token key atrule">env</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> BROKER_URL
          <span class="token key atrule">value</span><span class="token punctuation">:</span> amqp<span class="token punctuation">:</span>//guest<span class="token punctuation">:</span>guest@rabbitmq<span class="token punctuation">-</span>service<span class="token punctuation">:</span><span class="token number">5672</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> QUEUE
          <span class="token key atrule">value</span><span class="token punctuation">:</span> job1
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> OnFailure
</code></pre>
<blockquote>
<p><strong>[Success] &#x63D0;&#x793A;</strong></p>
<p>&#x6B64;&#x5904;&#x4F7F;&#x7528;&#x7684; RabbitMQ &#x662F; Kubernetes &#x5B98;&#x65B9;&#x4F9B;&#x5927;&#x5BB6;&#x7EC3;&#x4E60;&#x7528;&#x7684;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x81EA;&#x5DF1;&#x90E8;&#x7F72;&#x4E00;&#x4E2A;&#x6765;&#x6D4B;&#x8BD5;&#x3002;</p>
<p>&#x6B64;&#x6B21;&#x5BB9;&#x5668;&#x7684;&#x955C;&#x50CF;&#x4E0D;&#x662F;&#x771F;&#x5B9E;&#x5B58;&#x5728;&#x7684;&#xFF0C;&#x8981;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;&#xFF0C;&#x53EF;&#x53C2;&#x8003; <a href="https://kubernetes.io/docs/tasks/job/_print/#create-an-image" target="_blank">https://kubernetes.io/docs/tasks/job/_print/#create-an-image</a> &#x6784;&#x5EFA;&#x955C;&#x50CF;&#x6D4B;&#x8BD5;&#x3002;</p>
</blockquote>
<p>&#x5BF9;&#x4E8E;&#x6CA1;&#x6709;&#x8BBE;&#x7F6E; <code>.spec.completions</code> &#x7684; Job&#xFF0C;&#x60C5;&#x51B5;&#x590D;&#x6742;&#x7684;&#x591A;&#xFF0C;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x4EFB;&#x52A1;&#x7684;&#x603B;&#x6570;&#x662F;&#x672A;&#x77E5;&#x7684;&#x3002;</p>
<p>&#x4E0D;&#x8BBE;&#x7F6E; <code>.spec.completions</code> &#x7684;&#x5E26;&#x5DE5;&#x4F5C;&#x961F;&#x5217;&#x7684; Job &#x4F1A;&#x540C;&#x65F6;&#x542F;&#x52A8;&#x591A;&#x4E2A; Pod&#xFF0C;&#x53EA;&#x8981;&#x6709;&#x4EFB;&#x610F;&#x4E00;&#x4E2A; Pod &#x6210;&#x529F;&#x9000;&#x51FA;&#xFF0C;Job &#x63A7;&#x5236;&#x5668;&#x5C31;&#x77E5;&#x9053;&#x4EFB;&#x52A1;&#x5DF2;&#x7ECF;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x6240;&#x6709;&#x7684; Pod &#x5C06;&#x5F88;&#x5FEB;&#x4F1A;&#x9000;&#x51FA;&#x3002; &#x5F53;&#x6240;&#x6709; Pod &#x7ED3;&#x675F;&#xFF0C;&#x6B64; Job &#x624D;&#x4F1A;&#x6807;&#x8BB0;&#x4E3A;&#x6210;&#x529F;&#x5B8C;&#x6210;&#xFF0C;&#x867D;&#x7136;&#x53EA;&#x9700;&#x8981;&#x6709;&#x4E00;&#x4E2A; Pod &#x5B8C;&#x6210;&#x5373;&#x53EF;&#xFF0C;&#x4F46; Job &#x63A7;&#x5236;&#x5668;&#x8FD8;&#x662F;&#x4F1A;&#x7B49;&#x5F85;&#x5176;&#x5B83; Pod &#x7ED3;&#x675F;&#x3002;</p>
<p>&#x7B14;&#x8005;&#x6458;&#x5F55; Kubernetes &#x5B98;&#x65B9;&#x6587;&#x6863;&#x5173;&#x4E8E;&#x8FD9;&#x79CD; Job &#x7684;&#x63CF;&#x8FF0;&#xFF1A;</p>
<ul>
<li>&#x4E0D;&#x8BBE;&#x7F6E; <code>spec.completions</code>&#x3002;</li>
<li>&#x591A;&#x4E2A; Pod &#x4E4B;&#x95F4;&#x5FC5;&#x987B;&#x76F8;&#x4E92;&#x534F;&#x8C03;&#xFF0C;&#x6216;&#x8005;&#x501F;&#x52A9;&#x5916;&#x90E8;&#x670D;&#x52A1;&#x786E;&#x5B9A;&#x6BCF;&#x4E2A; Pod &#x8981;&#x5904;&#x7406;&#x54EA;&#x4E2A;&#x5DE5;&#x4F5C;&#x6761;&#x76EE;&#x3002;</li>
<li>&#x6BCF;&#x4E2A; Pod &#x90FD;&#x53EF;&#x4EE5;&#x72EC;&#x7ACB;&#x786E;&#x5B9A;&#x662F;&#x5426;&#x5176;&#x5B83; Pod &#x90FD;&#x5DF2;&#x5B8C;&#x6210;&#xFF0C;&#x8FDB;&#x800C;&#x786E;&#x5B9A; Job &#x662F;&#x5426;&#x5B8C;&#x6210;</li>
<li>&#x5F53; Job &#x4E2D; &#x4EFB;&#x4F55; Pod &#x6210;&#x529F;&#x7EC8;&#x6B62;&#xFF0C;&#x4E0D;&#x518D;&#x521B;&#x5EFA;&#x65B0; Pod</li>
<li>&#x4E00;&#x65E6;&#x81F3;&#x5C11; 1 &#x4E2A; Pod &#x6210;&#x529F;&#x5B8C;&#x6210;&#xFF0C;&#x5E76;&#x4E14;&#x6240;&#x6709; Pod &#x90FD;&#x5DF2;&#x7EC8;&#x6B62;&#xFF0C;&#x5373;&#x53EF;&#x5BA3;&#x544A; Job &#x6210;&#x529F;&#x5B8C;&#x6210;</li>
<li>&#x4E00;&#x65E6;&#x4EFB;&#x4F55; Pod &#x6210;&#x529F;&#x9000;&#x51FA;&#xFF0C;&#x4EFB;&#x4F55;&#x5176;&#x5B83; Pod &#x90FD;&#x4E0D;&#x5E94;&#x518D;&#x5BF9;&#x6B64;&#x4EFB;&#x52A1;&#x6267;&#x884C;&#x4EFB;&#x4F55;&#x64CD;&#x4F5C;&#x6216;&#x751F;&#x6210;&#x4EFB;&#x4F55;&#x8F93;&#x51FA;&#x3002; &#x6240;&#x6709; Pod &#x90FD;&#x5E94;&#x542F;&#x52A8;&#x9000;&#x51FA;&#x8FC7;&#x7A0B;&#x3002;</li>
</ul>
<p>&#x5BF9;&#x4E8E;&#x8FD9;&#x79CD; Job &#xFF0C;&#x4F7F;&#x7528;&#x8D77;&#x6765;&#x6BD4;&#x8F83;&#x590D;&#x6742;&#xFF0C;&#x8FD9;&#x79CD; Job &#x4E00;&#x822C;&#x9700;&#x8981;&#x7ED3;&#x5408;&#x5916;&#x90E8;&#x670D;&#x52A1;&#x6765;&#x5B8C;&#x6210;&#x4EFB;&#x52A1;&#xFF0C;&#x4F8B;&#x5982;&#x524D;&#x9762;&#x63D0;&#x5230;&#x4E86; RabbitMQ&#x3002;</p>
<p>&#x4EE5;&#x524D;&#x9762;&#x7684; RabbitMQ &#x4E3A;&#x4F8B;&#xFF0C;Job &#x542F;&#x52A8;&#x4E86; 5 &#x4E2A; Pod &#x6D88;&#x8D39;&#x6D88;&#x606F;&#xFF0C;&#x5F53; RabbitMQ &#x6CA1;&#x6709;&#x6D88;&#x606F;&#x4E86;&#xFF0C;&#x6B64;&#x65F6; Pod1 &#x628A;&#x4EFB;&#x52A1;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x7136;&#x540E;&#x8BF7;&#x6C42; RabbitMQ &#xFF0C;&#x53D1;&#x73B0;&#x6CA1;&#x6709;&#x6D88;&#x606F;&#x53EF;&#x5904;&#x7406;&#xFF0C;Pod1 &#x4FBF;&#x7ED3;&#x675F;&#x8FD0;&#x884C;&#x3002;&#x6B64;&#x65F6; Job &#x5DF2;&#x7ECF;&#x7B97;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A; Job &#x7684;&#x4EFB;&#x52A1;&#x662F;&#x5904;&#x7406;&#x5B8C; RabbitMQ&#xFF0C;RabbitMQ &#x6CA1;&#x6709;&#x6D88;&#x606F;&#x4E86;&#xFF0C;&#x6B64; Job &#x81EA;&#x7136;&#x7B97;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x4F46;&#x662F;&#x6B64;&#x65F6;&#x8FD8;&#x6709;&#x56DB;&#x4E2A; Pod &#x53D6;&#x5230;&#x4E86;&#x6D88;&#x606F;&#x4F46;&#x662F;&#x5C31;&#x6CA1;&#x6709;&#x8BA1;&#x7B97;&#x5B8C;&#x6210;&#xFF0C;&#x8FD9;&#x56DB;&#x4E2A; Pod &#x7EE7;&#x7EED;&#x5904;&#x7406;&#x5B8C;&#x6210;&#x4EFB;&#x52A1;&#x3002;&#x5F53; 5 &#x4E2A; Pod &#x90FD;&#x7ED3;&#x675F;&#x65F6;&#xFF0C;&#x6B64; Job &#x4FBF;&#x529F;&#x5FB7;&#x5706;&#x6EE1;&#x4E86;&#x3002;</p>
<h3 id="&#x5E26;&#x7C7B;&#x578B;&#x7684;-job"><a name="&#x5E26;&#x7C7B;&#x578B;&#x7684;-job" class="anchor-navigation-ex-anchor" href="#&#x5E26;&#x7C7B;&#x578B;&#x7684;-job"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E26;&#x7C7B;&#x578B;&#x7684; Job</h3>
<p>Job &#x4E2D;&#x7684; Pod &#x90FD;&#x662F;&#x4E00;&#x6837;&#x7684;&#xFF0C;&#x56E0;&#x6B64;&#x5982;&#x679C;&#x8981; Job &#x5904;&#x7406;&#x4E0D;&#x540C;&#x7684;&#x5DE5;&#x4F5C;&#x4EFB;&#x52A1;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x5916;&#x754C;&#x5E2E;&#x5FD9;&#x3002;</p>
<p>&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x5E73;&#x53F0;&#x662F;&#x4E00;&#x4E2A;&#x7535;&#x5546;&#x7CFB;&#x7EDF;&#xFF0C;&#x6D88;&#x606F;&#x961F;&#x5217;&#x4E2D;&#x6709;&#x8BC4;&#x8BBA;&#x3001;&#x8BA2;&#x5355;&#x7B49;&#x4E94;&#x7C7B;&#x6D88;&#x606F;&#xFF0C;&#x90A3;&#x4E48;&#x5E94;&#x8BE5;&#x8BBE;&#x8BA1;&#x4E94;&#x79CD;&#x7A0B;&#x5E8F;&#x53BB;&#x5904;&#x7406;&#x8FD9;&#x4E9B;&#x6D88;&#x606F;&#xFF0C;&#x4F46;&#x662F; Pod &#x53EA;&#x6709;&#x4E00;&#x79CD;&#x3002;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x539F;&#x5B50;&#x6027;&#x7684;&#x4EFB;&#x52A1;&#x9886;&#x53D6;&#x4E2D;&#x5FC3;&#xFF0C;Job &#x542F;&#x52A8; Pod &#x540E;&#xFF0C;Pod &#x4FBF;&#x5411;&#x4EFB;&#x52A1;&#x4E2D;&#x5FC3;&#x9886;&#x53D6;&#x4EFB;&#x52A1;&#x7C7B;&#x578B;&#xFF0C;&#x9886;&#x53D6;&#x5230;&#x540E;&#xFF0C;&#x5F00;&#x59CB;&#x5DE5;&#x4F5C;&#x3002;</p>
<p>&#x90A3;&#x4E48; Job &#x4E2D;&#x7684; Pod &#x53EF;&#x80FD;&#x662F;&#x8FD9;&#x6837;&#x5B8C;&#x6210;&#x5DE5;&#x4F5C;&#x7684;&#xFF1A;</p>
<div class="mermaid">
gantt
dateFormat  YYYY-MM-DD
title Message Queue

section Job
&#x8BC4;&#x8BBA;&#x5904;&#x7406;          :done  , 2021-11-01, 1d
&#x95EE;&#x7B54;&#x5904;&#x7406;          :done, 2021-11-02, 1d
&#x5DEE;&#x8BC4;&#x5904;&#x7406;          :done, 2021-11-03, 1d
&#x8BA2;&#x5355;&#x5904;&#x7406;          :done, 2021-11-04, 1d
&#x9000;&#x8D27;&#x5904;&#x7406;          :active, 2021-11-05, 1d
</div>

<blockquote>
<p><strong>[Info] &#x63D0;&#x793A;</strong></p>
<p>&#x9650;&#x4E8E;&#x6761;&#x4EF6;&#xFF0C;&#x8FD9;&#x91CC;&#x5C31;&#x4E0D;&#x7F16;&#x5199;&#x5177;&#x6709;&#x8FD9;&#x79CD;&#x529F;&#x80FD;&#x7684;&#x7A0B;&#x5E8F;&#x4E86;&#xFF0C;&#x8BFB;&#x8005;&#x53EA;&#x9700;&#x8981;&#x4E86;&#x89E3;&#x5373;&#x53EF;&#x3002;</p>
</blockquote>
<p>&#x5728; Job &#x521B;&#x5EFA;&#x7684; Pod &#x4E2D;&#xFF0C;&#x4F1A;&#x6709;&#x4E2A;&#x540D;&#x4E3A; <code>JOB_COMPLETION_INDEX</code> &#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF0C;&#x6B64;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x6807;&#x8BC6;&#x4E86; Pod &#x7684;&#x7D22;&#x5F15;&#xFF0C;Pod &#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6B64;&#x7D22;&#x5F15;&#x6807;&#x8BC6;&#x81EA;&#x5DF1;&#x7684;&#x8EAB;&#x4EFD;&#x3002;</p>
<p>&#x793A;&#x4F8B; YAML &#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">parallelism</span><span class="token punctuation">:</span> <span class="token number">1</span>
  <span class="token key atrule">completions</span><span class="token punctuation">:</span> <span class="token number">5</span>
  <span class="token key atrule">completionMode</span><span class="token punctuation">:</span> Indexed
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">image</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;env&quot;</span><span class="token punctuation">]</span>
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Never
</code></pre>
<blockquote>
<p><strong>[Info] &#x63D0;&#x793A;</strong></p>
<p><code>completionMode: Indexed</code> &#x8868;&#x660E;&#x5F53;&#x524D; Pod &#x662F;&#x5E26;&#x7D22;&#x5F15;&#x7684;&#xFF0C;&#x5982;&#x679C; <code>completionMode: NonIndexed</code> &#x5219;&#x4E0D;&#x5E26;&#x7D22;&#x5F15;&#x3002;</p>
<p>&#x7D22;&#x5F15;&#x4F1A;&#x6309;&#x7167; 0&#xFF0C;1&#xFF0C;2&#xFF0C;3 &#x8FD9;&#x6837;&#x9012;&#x589E;&#x3002;</p>
</blockquote>
<p>&#x6267;&#x884C; <code>kubectl apply -f job.yaml</code> &#x542F;&#x52A8;&#x6B64; Job&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@master:~<span class="token comment"># kubectl get pods</span>
NAME                       READY   STATUS             RESTARTS          AGE
busybox-0-j8gvz            <span class="token number">0</span>/1     Completed          <span class="token number">0</span>                 29s
busybox-1-k4kfx            <span class="token number">0</span>/1     Completed          <span class="token number">0</span>                 25s
busybox-2-zplxl            <span class="token number">0</span>/1     Completed          <span class="token number">0</span>                 14s
busybox-3-pj4jk            <span class="token number">0</span>/1     Completed          <span class="token number">0</span>                 10s
busybox-4-q5fq9            <span class="token number">0</span>/1     Completed          <span class="token number">0</span>                 6s
</code></pre>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x67E5;&#x770B; Pod &#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@master:~<span class="token comment"># kubectl logs busybox-0-j8gvz</span>
<span class="token assign-left variable"><span class="token environment constant">PATH</span></span><span class="token operator">=</span>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
<span class="token assign-left variable"><span class="token environment constant">HOSTNAME</span></span><span class="token operator">=</span>busybox-0
<span class="token assign-left variable">JOB_COMPLETION_INDEX</span><span class="token operator">=</span><span class="token number">0</span>
<span class="token assign-left variable">KUBERNETES_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.96</span>.0.1
<span class="token assign-left variable">KUBERNETES_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">KUBERNETES_SERVICE_PORT_HTTPS</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">KUBERNETES_PORT</span><span class="token operator">=</span>tcp://10.96.0.1:443
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP</span><span class="token operator">=</span>tcp://10.96.0.1:443
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_PROTO</span><span class="token operator">=</span>tcp
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_PORT</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_ADDR</span><span class="token operator">=</span><span class="token number">10.96</span>.0.1
<span class="token assign-left variable"><span class="token environment constant">HOME</span></span><span class="token operator">=</span>/root
</code></pre>
<h2 id="&#x5904;&#x7406;-pod-&#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;"><a name="&#x5904;&#x7406;-pod-&#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;" class="anchor-navigation-ex-anchor" href="#&#x5904;&#x7406;-pod-&#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5904;&#x7406; Pod &#x548C;&#x5BB9;&#x5668;&#x5931;&#x6548;</h2>
<h3 id="job-&#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;"><a name="job-&#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;" class="anchor-navigation-ex-anchor" href="#job-&#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>Job &#x7EC8;&#x6B62;&#x548C;&#x6E05;&#x7406;</h3>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x4E0D;&#x5E0C;&#x671B; Job &#x8FD0;&#x884C;&#x592A;&#x957F;&#x65F6;&#x95F4;&#xFF0C;&#x53EF;&#x4EE5;&#x4E3A; Job &#x7684; <code>.spec.activeDeadlineSeconds</code> &#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x79D2;&#x6570;&#x503C;&#x3002; &#x5728; Job &#x7684;&#x6574;&#x4E2A;&#x751F;&#x547D;&#x671F;&#xFF0C;&#x65E0;&#x8BBA; Job &#x521B;&#x5EFA;&#x4E86;&#x591A;&#x5C11;&#x4E2A; Pod&#x3002; &#x4E00;&#x65E6; Job &#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x8FBE;&#x5230; <code>activeDeadlineSeconds</code> &#x79D2;&#xFF0C;&#x5176;&#x6240;&#x6709;&#x8FD0;&#x884C;&#x4E2D;&#x7684; Pod &#x90FD;&#x4F1A;&#x88AB;&#x7EC8;&#x6B62;&#xFF0C;&#x5E76;&#x4E14; Job &#x7684;&#x72B6;&#x6001;&#x66F4;&#x65B0;&#x4E3A; <code>type: Failed</code> &#x53CA; <code>reason: DeadlineExceeded</code>&#x3002;</p>
<p>YAML &#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Job
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">completions</span><span class="token punctuation">:</span> <span class="token number">5</span> 
  <span class="token key atrule">activeDeadlineSeconds</span><span class="token punctuation">:</span> <span class="token number">2</span>
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span> 
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">image</span><span class="token punctuation">:</span> busybox
        <span class="token key atrule">command</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;/bin/sleep&quot;</span><span class="token punctuation">]</span>
        <span class="token key atrule">args</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">&quot;3&quot;</span><span class="token punctuation">]</span>
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Never
</code></pre>
<h2 id="cronjob"><a name="cronjob" class="anchor-navigation-ex-anchor" href="#cronjob"><i class="fa fa-link" aria-hidden="true"></i></a>CronJob</h2>
<p>CronJobs &#x5BF9;&#x4E8E;&#x521B;&#x5EFA;&#x5468;&#x671F;&#x6027;&#x7684;&#x3001;&#x53CD;&#x590D;&#x91CD;&#x590D;&#x7684;&#x4EFB;&#x52A1;&#x5F88;&#x6709;&#x7528;&#xFF0C;&#x4F8B;&#x5982;&#x6267;&#x884C;&#x6570;&#x636E;&#x5907;&#x4EFD;&#x6216;&#x8005;&#x53D1;&#x9001;&#x90AE;&#x4EF6;&#x3002; CronJobs &#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x8BA1;&#x5212;&#x5728;&#x6307;&#x5B9A;&#x65F6;&#x95F4;&#x65F6;&#x6765;&#x6267;&#x884C;&#x7684;&#x72EC;&#x7ACB;&#x4EFB;&#x52A1;&#xFF0C;&#x4F8B;&#x5982;&#x8BA1;&#x5212;&#x5F53;&#x96C6;&#x7FA4;&#x770B;&#x8D77;&#x6765;&#x5F88;&#x7A7A;&#x95F2;&#x65F6; &#x6267;&#x884C;&#x67D0;&#x4E2A; Job&#x3002;</p>
<p>CronJob &#x6709; &#x4E2A; schedule &#x5B57;&#x6BB5;&#xFF0C;&#x7528;&#x6765;&#x914D;&#x7F6E;&#x5408;&#x9002;&#x542F;&#x52A8;&#x6B64; CronJob&#xFF0C;&#x5176;&#x4F7F;&#x7528;&#x4E94;&#x4E2A;&#x65F6;&#x95F4;&#x5355;&#x4F4D;&#xFF0C;&#x6BCF;&#x4E00;&#x4F4D;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x65F6;&#x523B;&#x8868;&#x793A;&#xFF0C;&#x5982; <code>&quot;*/1 * * * *&quot;</code>&#x3002;</p>
<pre class="language-"><code># &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; &#x5206;&#x949F; (0 - 59)
# &#x2502; &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; &#x5C0F;&#x65F6; (0 - 23)
# &#x2502; &#x2502; &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; &#x6708;&#x7684;&#x67D0;&#x5929; (1 - 31)
# &#x2502; &#x2502; &#x2502; &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; &#x6708;&#x4EFD; (1 - 12)
# &#x2502; &#x2502; &#x2502; &#x2502; &#x250C;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; &#x5468;&#x7684;&#x67D0;&#x5929; (0 - 6) &#xFF08;&#x5468;&#x65E5;&#x5230;&#x5468;&#x4E00;&#xFF1B;&#x5728;&#x67D0;&#x4E9B;&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;7 &#x4E5F;&#x662F;&#x661F;&#x671F;&#x65E5;&#xFF09;
# &#x2502; &#x2502; &#x2502; &#x2502; &#x2502;                                   
# &#x2502; &#x2502; &#x2502; &#x2502; &#x2502;
# &#x2502; &#x2502; &#x2502; &#x2502; &#x2502;
# * * * * *
</code></pre><p>&#x6BCF;&#x4E2A;&#x5C0F;&#x65F6;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x5728; 0 &#x5206;&#x65F6;&#x5F00;&#x59CB;&#x8FD0;&#x884C;&#xFF1A;<code>0 * * * *</code>&#xFF0C;&#x6216;&#x4F7F;&#x7528; <code>@hourly</code> &#x8868;&#x793A;&#x3002;</p>
<p>&#x6BCF;&#x5929;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x5728;&#x534A;&#x591C; 0 &#x65F6; 0 &#x5206;&#x8FD0;&#x884C;&#xFF1A; <code>0 0 * * *</code> &#xFF0C;&#x6216;&#x4F7F;&#x7528; <code>@daily</code> &#x8868;&#x793A;&#x3002;</p>
<p>&#x5728;&#x6BCF;&#x5468;&#x7684;&#x5468;&#x65E5; 0 &#x70B9;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x65F6;&#x95F4;&#x5728;&#x534A;&#x591C;&#xFF1A; <code>0 0 * * 0</code>&#xFF0C;&#x6216;&#x4F7F;&#x7528; <code>@weekly</code> &#x8868;&#x793A;&#x3002;</p>
<p>&#x5728;&#x6BCF;&#x6708;&#x7684; 1 &#x53F7;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#xFF1A; <code>0 0 1 * *</code> &#xFF0C;&#x6216;&#x4F7F;&#x7528; <code>@monthly</code> &#x8868;&#x793A;&#x3002;</p>
<p>&#x6BCF;&#x5E74;&#x7684; 1 &#x6708; 1 &#x65E5; &#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF1A;<code>0 0 1 1 *</code> &#xFF0C;&#x6216;&#x4F7F;&#x7528; <code>@yearly</code> &#x8868;&#x793A;&#x3002;</p>
<p>CronJob &#x6709;&#x56DB;&#x79CD;&#x7B26;&#x5408;&#xFF0C;&#x5206;&#x522B;&#x662F; <code>*</code> &#x3001;<code>,</code> &#x3001;<code>-</code> &#x3001;<code>/</code>&#x3002;</p>
<p>&#x7B26;&#x53F7; <code>/</code> &#xFF0C;&#x4F7F;&#x7528;&#x683C;&#x5F0F; <code>*/{&#x503C;}</code> &#xFF0C;&#x8868;&#x793A;&#x6BCF;&#x95F4;&#x9694; 1 &#x4E2A; &#x65F6;&#x95F4;&#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x4F8B;&#x5982; <code>*/1 * * * *</code> &#x8868;&#x793A;&#x95F4;&#x9694;&#x4E00;&#x5206;&#x949F;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x3002;</p>
<p>&#x7B26;&#x53F7; <code>-</code>&#xFF0C;&#x4F7F;&#x7528;&#x683C;&#x5F0F; <code>{&#x503C;1}-{&#x503C;2}</code>&#xFF0C;&#x8868;&#x793A;&#x8303;&#x56F4;&#x4E2D;&#x7684;&#x6BCF;&#x4E00;&#x4E2A;&#x65F6;&#x95F4;&#xFF0C;&#x4F8B;&#x5982; <code>0-2 * * * *</code> &#x8868;&#x793A; 0 &#x5230; 20 &#x5206;&#x949F;&#x7684;&#x6BCF;&#x4E00;&#x5206;&#x949F;&#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x4E00;&#x5171; 20 &#x6B21;&#x3002;</p>
<p>&#x7B26;&#x53F7; <code>,</code>&#xFF0C;&#x4F7F;&#x7528;&#x683C;&#x5F0F; <code>*/{&#x503C;1},{&#x503C;2}...</code>&#xFF0C;&#x8868;&#x793A;&#x78B0;&#x5230;&#x8FD9;&#x91CC;&#x7684;&#x65F6;&#x95F4;&#x90FD;&#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x4F8B;&#x5982; <code>1,5,6 * * * *</code>&#xFF0C;&#x8868;&#x793A; &#x6BCF;&#x6B21;&#x5728; 1&#xFF0C;5&#xFF0C;6 &#x5206;&#x949F;&#x65F6;&#x90FD;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x3002;</p>
<p>&#x7EC4;&#x5408;&#x793A;&#x4F8B;&#xFF0C;<code>23 0-20/2 * * *</code>&#xFF0C;&#x8868;&#x793A;&#x5728; <code>0-20</code> &#x70B9;&#x65F6;&#xFF0C;&#x6BCF;&#x95F4;&#x9694; <code>2</code> &#x4E2A;&#x5C0F;&#x65F6;&#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x5176;&#x5305;&#x62EC;&#x7684;&#x65F6;&#x95F4;&#xFF1A;</p>
<pre class="language-"><code>00:23:00
02:23:00
04:23:00
... ...
20:23:00
</code></pre><blockquote>
<p>&#x8BF7;&#x53C2;&#x8003;&#xFF1A;</p>
<p><a href="https://en.wikipedia.org/wiki/Cron" target="_blank">https://en.wikipedia.org/wiki/Cron</a></p>
<p><a href="https://crontab.guru" target="_blank">https://crontab.guru/</a></p>
</blockquote>
<p>&#x53EF;&#x4F9B;&#x5B9E;&#x9A8C;&#x7684; YAML &#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> batch/v1beta1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> CronJob
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> hello
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">schedule</span><span class="token punctuation">:</span> <span class="token string">&quot;*/1 * * * *&quot;</span>
  <span class="token key atrule">jobTemplate</span><span class="token punctuation">:</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">template</span><span class="token punctuation">:</span>
        <span class="token key atrule">spec</span><span class="token punctuation">:</span>
          <span class="token key atrule">containers</span><span class="token punctuation">:</span>
          <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> hello
            <span class="token key atrule">image</span><span class="token punctuation">:</span> busybox
            <span class="token key atrule">imagePullPolicy</span><span class="token punctuation">:</span> IfNotPresent
            <span class="token key atrule">command</span><span class="token punctuation">:</span>
            <span class="token punctuation">-</span> /bin/sh
            <span class="token punctuation">-</span> <span class="token punctuation">-</span>c
            <span class="token punctuation">-</span> date; echo Hello from the Kubernetes cluster
          <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> OnFailure
</code></pre>
<blockquote>
<p>&#x6B64; CronJob &#x4F1A;&#x6BCF;&#x5206;&#x949F;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x3002;</p>
</blockquote>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x75F4;&#x8005;&#x5DE5;&#x826F; 2021 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x6863;&#x6700;&#x540E;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2021-11-14 13:53:35
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="8.schedule.html" class="navigation navigation-prev " aria-label="Previous page: 3.8 Pod 调度">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../4.network/" class="navigation navigation-next " aria-label="Next page: 4.Kubernetes 网络">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.9 Jobs、CronJobs","level":"1.4.10","depth":2,"next":{"title":"4.Kubernetes 网络","level":"1.5","depth":1,"path":"4.network/README.md","ref":"4.network/README.md","articles":[{"title":"导读","level":"1.5.1","depth":2,"path":"4.network/README.md","ref":"4.network/README.md","articles":[]},{"title":"4.1 Kubernetes 网络","level":"1.5.2","depth":2,"path":"4.network/1.network.md","ref":"4.network/1.network.md","articles":[]},{"title":"4.2 Endpoint","level":"1.5.3","depth":2,"path":"4.network/2.endpoint.md","ref":"4.network/2.endpoint.md","articles":[]},{"title":"4.3 ingress","level":"1.5.4","depth":2,"path":"4.network/3.ingress.md","ref":"4.network/3.ingress.md","articles":[]},{"title":"4.4 服务发现","level":"1.5.5","depth":2,"path":"4.network/4.discovery.md","ref":"4.network/4.discovery.md","articles":[]}]},"previous":{"title":"3.8 Pod 调度","level":"1.4.9","depth":2,"path":"3.pod/8.schedule.md","ref":"3.pod/8.schedule.md","articles":[]},"dir":"ltr"},"config":{"plugins":["tbfed-pagefooter","anchor-navigation-ex","mermaid-gb3","insert-logo","chapter-fold","advanced-emoji","github","splitter","alerts","popup","prism","-highlight","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 痴者工良 2021","modify_label":"文档最后更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{"lang":{"flow":"typescript","shell":"bash"},"ignore":["mermaid","eval-js"],"css":["prismjs/themes/prism.css"],"js":["prismjs/prism.js","prismjs/components.js","prismjs/components/prism-go.min.js","prismjs/components/prism-yaml.min.js","prismjs/components/prism-bash.min.js","prismjs/components/prism-shell-session.min.js"]},"github":{"url":"https://github.com/whuanle/kubernetes"},"livereload":{},"splitter":{},"search":{},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"alerts":{},"advanced-emoji":{"embedEmojis":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"style":"background: none; max-height: 50px; min-height: 50px","url":"/images/logo.jpg"}},"theme":"default","author":"痴者工良","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Kubernetes - 痴者工良","language":"zh-hans","links":{"sidebar":{"痴者工良的博客":"https://www.whuanle.cn"}},"gitbook":"*","description":"这是一本关于 Kubernetes 的书，作者 痴者工良"},"file":{"path":"3.pod/9.jobs_cronjobs.md","mtime":"2021-11-14T05:53:35.766Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-11-16T23:21:22.294Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

